package com.sansecy.customview.activity;

import android.content.Context;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

import com.sansecy.customview.R;
import com.sansecy.customview.TabLayout;

public class TabLayoutActivity extends AppCompatActivity {
    public static void start(Context context) {
        Intent starter = new Intent(context, TabLayoutActivity.class);
        context.startActivity(starter);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_tab_layout);
        TabLayout tabLayout = findViewById(R.id.tabLayout);
        tabLayout.setIndicatorPaddingBottom(40);
        tabLayout.setTabSelectedTextSize(18);
        tabLayout.setSelectedTabTextStyle(Typeface.BOLD);
        tabLayout.setIndicatorWidthMode(TabLayout.MODE_INDICATOR_WIDTH_DYNAMIC);
        tabLayout.addTab(tabLayout.newTab(R.layout.layout_tab_item).setText("额外数据").setExtraView(R.layout.extra_view));
        tabLayout.addTab(tabLayout.newTab(R.layout.layout_tab_item).setText("1111").setExtraView(R.layout.extra_view));
        tabLayout.addTab(tabLayout.newTab(R.layout.layout_tab_item).setText("33333").setExtraView(R.layout.extra_view));
    }
}
